import pygame

class ScoreBoard:
    """记分板"""
    def __init__(self):
        self._score = 0 # 刚开始是0分
        self._font = pygame.font.SysFont("simsun", 36)

    def add(self, score):
        self._score += score #得分
    
    def render(self, screen:pygame.Surface):
        text = self._font.render(f"得分: {self._score}", True, "yellow")
        x = screen.get_width() - text.get_width() - 8
        y = screen.get_height() - text.get_height() - 8
        screen.blit(text, (x, y))